home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / program / n_b_v203.zip / FILEOPEN.DMO < prev    next >
Text File  |  1996-07-04  |  3KB  |  54 lines

  1. $if 0
  2.     ┌──────────────────────────╖                        PowerBASIC v3.20
  3.  ┌──┤          DASoft          ╟──────────────────────┬──────────────────╖
  4.  │  ├──────────────────────────╢    Copyright 1995    │ DATE: 1995-10-01 ╟─╖
  5.  │  │ FILE NAME   FILEOPEN.DMO ║          by          ╘════════════════─ ║ ║
  6.  │  │                          ║  Don Schullian, Jr.                     ║ ║
  7.  │  ╘══════════════════════════╝                                         ║ ║
  8.  │ A license is hereby granted to the holder to use this source code in  ║ ║
  9.  │ any program, commercial or otherwise,  without receiving the express  ║ ║
  10.  │ permission of the copyright holder and without paying any royalties,  ║ ║
  11.  │ as long as this code is not distributed in any compilable format.     ║ ║
  12.  │  IE: source code files, PowerBASIC Unit files, and printed listings   ║ ║
  13.  ╘═╤═════════════════════════════════════════════════════════════════════╝ ║
  14.    │                ....................................                   ║
  15.    ╘═══════════════════════════════════════════════════════════════════════╝
  16. $endif
  17.  
  18. $INCLUDE "DAS-NB01.INC"
  19. $INCLUDE "DAS-NB02.INC"
  20. COLOR 7,0
  21. CLS
  22.  
  23. ? "┌────────────────────────────────────────────────────────────────────────
  24. ? "│  LOCKon       ()
  25. ? "│  LOCKoff      ()
  26. ? "│ fCreateFile%  ( FileSpec$, Handle% )
  27. ? "│ fOpenFile%    ( FileSpec$, Handle% )
  28. ? "│  CloseFile    ( FileNo% )
  29. ? "├──────────────────────────────────────────────────────────────────────────
  30. ? "│ This suite of routines simply creates/opens and closes binary files. If
  31. ? "│ you have first called LOCKon then the whole file will be locked after it
  32. ? "│ is opened and UNLOCKed before it is closed. Handle% is the returned value
  33. ? "│ of DOS's file handle that is used by the read/write functions.
  34. ? "│ fOpenFile% will NOT open a file if it does not first exist and will kill
  35. ? "│ and close the file if it has a length of 0!
  36. ? "├──────────────────────────────────────────────────────────────────────────
  37. ? "│ fShareLoaded? ()  returns 255 if SHARE.EXE is loaded
  38. ? "├──────────────────────────────────────────────────────────────────────────
  39. ? "│ The importance of fShareLoaded? is that files, records, and/or bytes of
  40. ? "│ a file cannot be LOCKed if SHARE.EXE has not been loaded and an attempt
  41. ? "│ by your program(s) to do so will create error 73 and/or 75.
  42. ? "└──────────────────────────────────────────────────────────────────────────
  43. ?
  44.  
  45. LOCKon       ' turn on locking if SHARE.EXE has been loaded
  46. LOCKoff      ' turn it off ( we don't need it here anyhow )
  47.  
  48. FileNo% = fOpenFile%  ( "DUMMY.DAT", Handle% )
  49. 'FileNo% = fCreateFile%( "DUMMY.DAT", Handle% )           ' unrem this line
  50.  
  51. IF FileNo% = 0 THEN PRINT "DUMMY.DAT NOT OPENED!" : END
  52. PUT$ #FileNo%, "hello world"
  53. CloseFile FileNo%
  54.